// import { Promise } from "core-js";
import request from "./request.js";
//分页获取博客数据，get请求，我们用到了我们创建的实例request，我们创建一个函数直接把参数传入里面，就是路径上面需要的参数
export async function getBlogs(page = 1, limit = 10, categoryid = -1) {
    return await request.get('/api/blog', {
        params: {
            page,
            limit,
            categoryid,
        }
    })
}
//获取博客分类。
export async function getBlogTypes() {
    return await request.get('/api/blogtype')
}
//获取单个博客分类
export async function getBlog(id) {
    return await request.get(`/api/blog/${id}`)
}
//提交评论
export async function PostComment(comment) {
    return await request.post('/api/comment', comment)
}
//获取分页评论
export async function setPageComment(blogid, page = 1, limit = 10) {
    return await request.get('/api/comment', {
        params: {
            blogid,
            page,
            limit,
        }
    })
}